﻿using RosSharp;
using RosSharp.Utility;
using System;
using System.Threading;

namespace RosPublisher
{
    class Program
    {
        static void Main(string[] args)
        {
            LogHelper.Init(AppDomain.CurrentDomain.BaseDirectory + "log4net.config");

            Ros.MasterUri = new Uri("http://192.168.20.132:11311");
            Ros.HostName = "192.168.20.1";
            Ros.TopicTimeout = 50000;
            Ros.XmlRpcTimeout = 50000;

            var node = Ros.InitNodeAsync("/bbb").Result;
            var publisher = node.PublisherAsync<RosSharp.std_msgs.String>("/chatter").Result;
            while (true)
            {
                publisher.OnNext(new RosSharp.std_msgs.String() { data = "HelloWorld!" });
                Thread.Sleep(1000);
            }
        }
    }
}
